diffpress5 2.2.1
Loading...
Searching...
No Matches
diffpress5


Diff Press 5 Click

Diff Press 5 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Stefan Filipovic
  • Date : Jan 2025.
  • Type : ADC/I2C type

Software Support

Example Description

This example demonstrates the use of the Diff Press 5 Click board. It showcases how to initialize the device, calibrate the zero-pressure offset, and read the differential pressure data in Pascals (Pa) from the sensor.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.DiffPress5

Example Key Functions

Application Init

Initializes the logger and the Diff Press 5 Click driver. The application then performs zero-pressure offset calibration to ensure accurate pressure measurements. During the calibration, it is crucial to avoid applying pressure to the sensor.

void application_init ( void )
{
log_cfg_t log_cfg;
diffpress5_cfg_t diffpress5_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
diffpress5_cfg_setup( &diffpress5_cfg );
err_t init_flag = diffpress5_init( &diffpress5, &diffpress5_cfg );
if ( ( ADC_ERROR == init_flag ) || ( I2C_MASTER_ERROR == init_flag ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
log_printf( &logger, " Calibrating zero pressure offset in 5 seconds...\r\n" );
log_printf( &logger, " Make sure no pressure is applied to the sensor during the calibration process.\r\n" );
for ( uint8_t cnt = 5; cnt > 0; cnt-- )
{
log_printf( &logger, " %u\r\n", ( uint16_t ) cnt );
Delay_ms ( 1000 );
}
if ( DIFFPRESS5_ERROR == diffpress5_calib_offset ( &diffpress5 ) )
{
log_error( &logger, " Calibrate offset." );
for ( ; ; );
}
log_printf( &logger, " Offset calibration DONE.\r\n\n" );
log_info( &logger, " Application Task " );
}
@ DIFFPRESS5_ERROR
Definition diffpress5.h:184
#define DIFFPRESS5_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition diffpress5.h:122
void application_init(void)
Definition main.c:38
#define MIKROBUS_POSITION_DIFFPRESS5
Definition main.c:32

Application Task

Continuously reads the differential pressure from the sensor and logs the values in Pascals (Pa).

void application_task ( void )
{
uint16_t pressure = 0;
if ( DIFFPRESS5_OK == diffpress5_read_pressure ( &diffpress5, &pressure ) )
{
log_printf( &logger, " Pressure : %u Pa\r\n\n", pressure );
}
}
@ DIFFPRESS5_OK
Definition diffpress5.h:183
void application_task(void)
Definition main.c:83

Note

The measurable pressure range of the sensor is 0 to 10000 Pa.

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.